// ml:run = $bin < input
#include <iostream>

typedef long long ll;
ll const mo = 100000007;
int const maxn = 2200;

ll C[maxn][maxn];
int X, Y, x, y;

void calc(ll &r, int a, int aa, int b, int bb, int c, int cc, int d, int dd)
{
	ll t = 1;
    t = (t * C[aa][a]) % mo;
    t = (t * C[bb][b]) % mo;
    t = (t * C[cc][c]) % mo;
    t = (t * C[dd][d]) % mo;
	r = (r + t) % mo;
}

void init()
{
    C[0][0] = 1;
    for (int i = 1; i < maxn; i++) {
        C[i][0] = C[i][i] = 1;
        for (int j = 1; j < i; j++)
            C[i][j] = (C[i - 1][j] + C[i - 1][j - 1]) % mo;
    }
}

int main()
{
    std::ios_base::sync_with_stdio(false);
    init();
    int T; std::cin >> T;
    while (T--) {
        std::cin >> X >> Y >> x >> y;
        ll ans = 0;
        //down
        for (int i = 0; i <= x - 1 && i <= X - x && i <= y && i + 1 <= Y - y; i++)
            calc(ans, i, x - 1, i, X - x, i, y, i + 1, Y - y);

        //right
        for (int i = 0; i <= x - 1 && i <= X - x && i <= y && i <= Y - y; i++)
            calc(ans, i, x - 1, i, X - x, i, y, i, Y - y);

        //up
        for (int i = 0; i <= x - 1 && i + 1 <= X - x && i + 1 <= y && i + 1 <= Y - y; i++)
            calc(ans, i, x - 1, i + 1, X - x, i + 1, y, i + 1, Y - y);

        //left
        for (int i = 0; i <= x - 1 && i + 1 <= X - x && i <= y && i + 1 <= Y - y; i++)
            calc(ans, i, x - 1, i + 1, X - x, i, y, i + 1, Y - y);

        if (y && !x) ans = (ans + 1) % mo;
        if (!y && !x) ans = (ans + 1) % mo;
        std::cout << ans << "\n";
    }
}

